
//C++ Exercise 2 
//Submitters: Erez Shabat 300022498, Hen Amar 026592147

#include "cTime_t.h"
#include "cDate_t.h"
#include "cDateTime_t.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;

int RandomInt(int from , int to) {		// return random integer between [from-to] 
  int rnd = from + rand()%(to-from+1);
  return rnd;
}


int main(){
	srand (time(NULL));

	for (int i=0;i<3;i++) 
	{
		cout << "Random Test #" << i <<endl;
		cout << "---------------" << endl;
		cTime_t curtime;
		curtime.setPrintFormat(1+ (i % 2));
		cout << "curtime: " << curtime << endl;
		cTime_t randTime(RandomInt(0,23), RandomInt(0,59), RandomInt(0,59));
		cout << "random time: " << randTime << endl;
		cout << "curtime + random time: " << curtime + randTime << endl;

		cDate_t randDate(RandomInt(1,31), RandomInt(1,12), RandomInt(1970,2050));
		randDate.setPrintFormat(1 + (i % 3));
		cout << "random date: " << randDate << endl;
		cout << "day of year: " << randDate.getDayOfYear() << endl;
		cout << "monthName: " << randDate.getMonthName() << endl;
		cout << "Leap Year: " << (randDate.isYearLeap()? "True":"False") << endl;
		cout << "Day of week: " << randDate.getDayName() << endl;

		cDateTime_t datetime(RandomInt(1,31), RandomInt(1,12), RandomInt(1970,2050), RandomInt(0,23), RandomInt(0,59), RandomInt(0,59));
		cout << "random DateTime: " << datetime << endl;
		cout << "random DateTime + random time: " << datetime + randTime << endl;
		
		cout << endl;
	}
	return 0;

}